import request from "@/utils/request";

// 上传图片
export interface UploadImage {
  file: File;
  data?: Record<string, string>;
  params?: Record<string, string>;
}
export const uploadImage = (data: UploadImage) => {
  const formData = new FormData();
  formData.append("file", data.file);
  for (const prop in data.data) {
    formData.append(prop, data.data[prop]);
  }
  return request({
    url: "/tools/test",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data: formData,
    params: data.params,
  });
};
